import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import forEach from "./forEach";
/**
 * 前序遍历查找节点，多个匹配时也只会找到第一个匹配的节点
 * @param treeNodes
 * @param callback
 * @param options
 * @returns
 */
var find = function find(treeNodes, callback, options) {
  var result;
  forEach(treeNodes, function (treeNode, opts) {
    if (callback(treeNode, opts)) {
      result = treeNode;
      return true;
    }
  }, _objectSpread(_objectSpread({}, options), {}, {
    order: 'dlr'
  }));
  return result;
};
export default find;